package functions;

public class Functions {

	public static void print(Object obj) {
		System.out.println(obj);
	}
	
	public static int findMin (double buf[], int len) {
		int index = 0;
		double min = 65536;
		for (int i = 0; i < len; i++) {
			if ((buf[i] < min && buf[i] != 0) || (min == 0 && buf[i] != 0) ) {
				min = buf[i];
				index = i;
			}
		}
		return index;
	}
	public static int findMax (double buf[], int len) {
		int index = 0;
		double max = buf[0];
		for (int i = 1; i < len; i++) {
			if ((buf[i] > max && buf[i] != 0) || (max == 0 && buf[i] != 0) ) {
				max = buf[i];
				index = i;
			}
		}
		return index;
	}
	//task == true -> max
	public static boolean checkStatus(double data[][], int len, int yLen, boolean task) {
		if (task == true) {
			for (int i = 1; i < len; i++) 
				if (data[0][i] < 0)
					return false;
			return true;
		}
		else { 
			for (int i = 1; i < yLen; i++) 
				if (data[i][len] < 0)
					return false;
			return true;
		}
	}

}

